﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VNet.VisiSuite.VisiBoard.Common.Helpers
{
    public class SimpleNode
    {
        public SimpleNode()
        {
            Children = new List<SimpleNode>();    
        }

        public List<SimpleNode> Children { get; set; }
        public bool IsExpanded { get; set; }
        public string Text { get; set; }
        public object Object { get; set; }

        public void copy(SimpleNode node)
        {
            IsExpanded = node.IsExpanded;
            Text = node.Text;
            Object = node.Object;

            foreach (SimpleNode child in node.Children)
            {
                Children.Add(child.clone());
            }

        }

        private SimpleNode clone()
        {
            var clone = new SimpleNode
            {
                IsExpanded = this.IsExpanded,
                Text = this.Text,
                Object = this.Object
            };

            foreach (SimpleNode child in Children)
            {
                clone.Children.Add(child.clone());
            }

            return clone;

        }

    }

}
